#include "gtest/gtest.h"
#include "App.h"

TEST(AppTest, main){
    int argc = 0;
    char * argv[] = {
        (char*)"-h",
    };

    App app;
    app.run(argc, argv);
}

#include "BreakPointService.h"
TEST(BreakPointServiceTest, use){
    BreakPointService bpService;

    bpService.start();
    bpService.connected();
    bpService.receivedLoginResp("loginrsp-0-OK");

    bpService.timeout(); 
    bpService.receivedBreakPointResp("breakpoint-0-OK");

    bpService.receivedNormalResp("normal_1-0-OK");
    bpService.receivedNormalResp("normal_2-0-OK");
    bpService.receivedNormalResp("normal_3-0-OK");

    bpService.disconnected();
    
    bpService.stop();
}



#include "BreakPointMem.h"
#include "BreakPointFile.h"

TEST(BreakPointMemTest, use){
    IBreakPoint * bp = new BreakPointMem();
    ASSERT_EQ(-1, bp->get());

    const long long defSeqNo = 10001;
    bp->set(defSeqNo);
    ASSERT_EQ(defSeqNo, bp->get());

    delete bp;
}

TEST(BreakPointFileTest, use){

    IBreakPoint * bp = new BreakPointFile("seqNo.bin");

    const long long defSeqNo = 10001;
    bp->set(defSeqNo);
    ASSERT_EQ(defSeqNo, bp->get());

    delete bp;
}
